<% include ../header.ejs %>
<script src="/lib/echarts/echarts.common.min.js"></script>
<script src="/lib/echarts/macarons.js "></script>

<header data-am-widget="header" data-am-sticky class="am-header am-header-default" id="appTemplates-Nav">
    <div class="am-header-left am-header-nav">
        <a href='javascript:history.go(-1)' class="">
            <img class="am-header-icon-custom"
                 src="data:image/svg+xml;charset&#x3D;utf-8,&lt;svg xmlns&#x3D;&quot;http://www.w3.org/2000/svg&quot; viewBox&#x3D;&quot;0 0 12 20&quot;&gt;&lt;path d&#x3D;&quot;M10,0l2,2l-8,8l8,8l-2,2L0,10L10,0z&quot; fill&#x3D;&quot;%23fff&quot;/&gt;&lt;/svg&gt;"
                 alt=""/>
        </a>
    </div>

    <h1 class="am-header-title">
        <a href="#title-link" class="" id="Typeface-whitecolor">组合详情</a>
    </h1>

    <!--<div class="am-header-right am-header-nav">-->
    <!--<a id="a_save" onclick="javascript:;" class="" data-am-modal="{target: '#modal-type-add', closeViaDimmer: 0, width: 240, height: 260}">保存</a>-->
    <!--</div>-->
</header>

<div ng-app="stockgroupDetail" ng-controller="detailController" id="app">
    <div data-am-widget="list_news" class="am-list-news am-list-news-default">
        <!--列表标题-->
        <div class="am-list-news-hd am-cf">
            <!--带更多链接-->
            <a href="##" class="">
                <img ng-src="{{user.extension}}" alt="" class="am-comment-avatar" width="48" height="48"/>
                <h2>{{user.name}}</h2>
                <span class="am-list-news-more am-fr">持仓总市值：{{group.allVal}}</span>
                <br>
                <span class="am-list-news-more am-fr">占比：{{group.realRate}}%&nbsp;&nbsp;</span>

            </a>
        </div>


        <div class="am-btn-group am-btn-group-justify">
            <a type="button" class="am-btn  am-round" ng-class="page == 'default'?'am-btn-secondary':'am-btn-default'"
               ng-click="changePage('default')">基本信息</a>
            <a type="button" class="am-btn  am-round" ng-class="page == 'stockList'?'am-btn-secondary':'am-btn-default'"
               ng-click="changePage('stockList')">持仓详情</a>
            <a type="button" class="am-btn  am-round" ng-class="page == 'dealList'?'am-btn-secondary':'am-btn-default'"
               ng-click="changePage('dealList')">调仓记录</a>
        </div>
        <div class="am-margin-top-sm">
            <div ng-show="page == 'default'">
                <table class="am-table  am-table-centered">
                    <tr>
                        <td class="am-text-middle">
                            累&nbsp;&nbsp;&nbsp;计
                        </td>
                        <td class="am-text-middle">
                            {{group.ljRate||'0%'}}
                        </td>
                        <td class="am-text-middle">
                            实&nbsp;&nbsp;&nbsp;时
                        </td>
                        <td class="am-text-middle">
                            {{group.ljRate||'0%'}}
                        </td>
                    <tr>
                        <td class="am-text-middle">
                            年收益
                        </td>
                        <td class="am-text-middle">
                            {{group.yearRate||'0%'}}
                        </td>
                        <td class="am-text-middle">
                            季收益
                        </td>
                        <td class="am-text-middle">
                            {{group.jdRate||'0%'}}
                        </td>
                    </tr>
                    <tr>
                        <td class="am-text-middle">
                            月收益
                        </td>
                        <td class="am-text-middle">
                            {{group.monthRate||'0%'}}
                        </td>
                        <td class="am-text-middle">
                            周收益
                        </td>
                        <td class="am-text-middle">
                            {{group.weekRate||'0%'}}
                        </td>
                    </tr>

                </table>
                <div id="barView" style="height: 300px;width: 100%" ng-show="showChart">

                </div>
            </div>
            <!--股票视图-->
            <div class="am-tab-panel" ng-show="page=='stockList'" >

                <table class="am-table  am-table-centered">
                    <tr>
                        <td class="am-text-middle am-text-sm">
                            名称
                        </td>
                        <td class="am-text-middle am-text-sm">
                            市值
                        </td>
                        <td class="am-text-middle am-text-sm">
                            持仓
                        </td>
                        <td class="am-text-middle am-text-sm">
                            成本/数量
                        </td>
                        <td class="am-text-middle am-text-sm">
                            收益
                        </td>
                    </tr>

                    <tr></tr>

                    <tr ng-repeat="item in stockList" ng-click = "editStockPrice(item)">
                        <td class="am-text-middle am-text-sm">
                            {{item.stockId.name}}
                        </td>
                        <td class="am-text-middle am-text-sm">
                            {{item.positionVal|cutNum}}
                        </td>
                        <td class="am-text-middle am-text-sm">
                            {{item.positionNum|roundNum:item.realPic:group.allVal}}%
                        </td>
                        <td class="am-text-middle am-text-sm">
                            {{item.cost}}/{{item.positionNum|cutNum}}股
                        </td>
                        <td class="am-text-middle am-text-sm">
                            {{item.realRate||'0%'}}
                        </td>
                    </tr>


                </table>
            </div>
            <!--交易视图-->
            <div class="am-tab-panel" ng-show="page== 'dealList'">
                <div ng-repeat="item in dealList">
                    <hr>
                    <div>
                        <div class="am-g am-g-collapse-sm">
                            <div class="am-u-sm-8 am-text-left">{{item.stockChannelId.stockId.name}}({{item.stockChannelId.stockId.stockCode}})</div>
                            <div calss="am-u-sm-4 am-text-right">{{item.dealDate}}</div>
                        </div>
                        <div class="am-g ">
                            <span class="am-u-sm-2 am-u-sm-offset-1 am-text-middle am-badge  am-round am-margin-top-xs"
                                  ng-class="item.type=='1'?'am-badge-danger':'am-badge-success'">{{item.type=='1'?'买入':'卖出'}}</span>
                            <span calss="am-u-sm-1  " style="margin-left: 25%;"></span>
                            <span calss="am-u-sm-1 am-u-sm-offset-1 " style="margin-left: 16%;">{{item.positionRate}}</span>
                        </div>
                        <div class="am-g am-g-collapse-sm am-margin-bottom-sm" >
                            <div class="am-u-sm-8 am-text-left">{{item.type=='1'?'买入':'卖出'}}价：{{item.price||'0'}}</div>
                            <div calss="am-u-sm-4 am-text-right">数量：{{item.num||'0'}}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--成本修改-->
    <div class="am-modal am-modal-prompt" tabindex="-1" id="my-prompt">
        <div class="am-modal-dialog">
            <div class="am-modal-hd"></div>
            <div class="am-modal-bd">
                最新成本
                <input type="text" placeholder="最新成本" ng-model = "stock.cost" class="am-modal-prompt-input">
                最新持股量
                <input type="text" placeholder="最新持股量" ng-model = "stock.positionNum" class="am-modal-prompt-input">
            </div>
            <div class="am-modal-footer">
                <span class="am-modal-btn" data-am-modal-cancel>取消</span>
                <span class="am-modal-btn" data-am-modal-confirm>提交</span>
            </div>
        </div>
    </div>
    <!--底部按钮-->
    <div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default "
         id="" ng-show="thisUserId == user.rowId">
        <ul class="am-navbar-nav am-cf am-avg-sm-4">
            <li>
                <a ng-click="buy()" class="">
                    <span class="am-icon-cart-arrow-down"></span>
                    <span class="am-navbar-label">买入</span>
                </a>
            </li>
            <li>
                <a ng-click="sell()" class="">
                    <span class="am-icon-sign-out"></span>
                    <span class="am-navbar-label">卖出</span>
                </a>
            </li>
        </ul>
    </div>
</div>
</div>
<script src="/javascripts/app/stockgroup/detail.js"></script>
<script>
    var groupId = '<%= groupId %>';
    var thisUserId = '<%=userinfo.rowId%>';

</script>
<% include ../footer.ejs %>